package nl.hanze.shoestring.ui;

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import nl.hanze.shoestring.logic.Logic;

/**
 *
 * @author Alex, Henk, Jehannes
 */
public class MainScreen extends JFrame {

    Logic logic;

    public MainScreen(Logic logic) {
        this.logic = logic;

       
        setSize(1024, 768);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        int w = dim.getSize().width;
        int h = dim.getSize().height;
        setLocation((w-1024)/2, (h-768)/2);
        // wijzig onleesbare disabled JComboBox kleuren
        UIManager.put("ComboBox.disabledForeground", Color.BLACK);
        UIManager.put("ComboBox.disabledBackground", Color.LIGHT_GRAY);
    
        addTabs();
        setVisible(true);
    }

    private void addTabs() {
        // JPanel reserveringen bevat tevens een Deelnemer panel
        JPanel cardReservering = new JPanel(new CardLayout());
        DeelnemerPanel deelnemerPanel = new DeelnemerPanel(logic, cardReservering);
        ReserveringPanel reserveringPanel = new ReserveringPanel(logic, cardReservering, deelnemerPanel);
        cardReservering.add(reserveringPanel,"R");
        cardReservering.add(deelnemerPanel,"D");

        JTabbedPane pane = new JTabbedPane();
        pane.addTab("Planning", new PlanningPanel(logic));
        pane.add("Reservering+", cardReservering);
        pane.addTab("Reizen", new ReisPanel(logic));
        pane.addTab("Reistypes", new ReistypePanel(logic));
        pane.addTab("Klanten", new KlantPanel(logic));
        pane.addTab("Medewerkers", new MedewerkerPanel(logic));
        pane.addTab("Landen", new LandPanel(logic));
        pane.addTab("Continenten", new ContinentPanel(logic));
        pane.addTab("Groepskorting", new GroepskortingPanel(logic));
        add(pane);
    }
}
